package com.xiaotian.common.code;

import com.xiaotian.common.response.ResultCode;

public enum CommonCode implements ResultCode {

    SUCCESS(true,10000,"操作成功！"),
    FAIL(false,11111,"操作失败！"),
    UNAUTHENTICATED(false,10001,"此操作需要登陆系统！"),
    UNAUTHORISE(false,10002,"权限不足，无权操作！"),
    SERVER_ERROR(false,99999,"抱歉，系统繁忙，请稍后重试！"),
    INVALIDPARAM(false, 10003, "非法参数!");

    /**
     * 操作是否成功,true为成功，false操作失败
     */
    boolean success;

    /**
     * 操作代码
     *
     * @return
     */
    int code;

    /**
     * 提示信息
     *
     * @return
     */
    String message;

    CommonCode(boolean success, int code, String message) {
        this.success = success;
        this.message = message;
        this.code = code;
    }

    @Override
    public boolean success() {
        return false;
    }

    @Override
    public int code() {
        return 0;
    }

    @Override
    public String message() {
        return null;
    }
}
